package com.mall.user.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.mall.user.entity.param.RolePermissionAddParam;
import com.mall.user.entity.po.RolePermission;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * <p>
 * Mapper 接口
 * </p>
 *
 * @author wuyijie
 * @since 2021-06-20
 */
public interface RolePermissionMapper extends BaseMapper<RolePermission> {

    @Insert(
            "<script>" +
                    "insert into role_permission (role_id,permission_id) values " +
                    "<foreach item='item' index='index' collection='list' separator=','>" +
                    "(#{item.roleId},#{item.permissionId})" +
                    "</foreach>" +
                    "</script>")
    int insertBatch(@Param("list") List<RolePermissionAddParam> list);


}
